<template>
	<view class="web_bg">
		<cu-custom bgColor="bg-gradual-green" :isBack="true">
			<template #backText>
				<text>设置</text>
			</template>
			<template #content>
				<text>设置</text>
			</template>
		</cu-custom>
		<view class="">
			<button class="cu-btn bg-grey lg shadow logOut" @click="logOut">退出登录</button>
		</view>
		<view class="cu-modal" :class="modalName=='DialogModal'?'show':''">
			<view class="cu-dialog">
				<view class="cu-bar bg-white justify-end">
					<view class="content">退出登录</view>
					<view class="action" @tap="hideModal(0)">
						<text class="cuIcon-close text-red"></text>
					</view>
				</view>
				<view class="padding-xl">
					是否要退出当前账号？
				</view>
				<view class="cu-bar bg-white justify-end">
					<view class="action">
						<button class="cu-btn bg-green margin-left" @tap="hideModal(1)">确定</button>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script setup>
	import {
		ref
	} from "vue"
	let modalName = ref(null)
	//确定是否退出登录
	let logOut = () => {
		modalName.value = "DialogModal"
	}
	//退出登录
	let hideModal = (type) => {
		if (!type) {
			modalName.value = null
		} else {
			uni.clearStorageSync()
			uni.reLaunch({
				url: "/pages/login"
			})
		}

	}
</script>

<style scoped>
	.logOut {
		width: 100%;
	}
</style>